<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>用户管理</title>
    <script type="text/javascript" src="./../../../static/js/include/_include-css.js"></script>

</head>

<body class="bg-gray">
    <div class="wrapper">
        <div class="wrapper-container">
            <div class="row">
                <div class="col-md-12 ">
                    <div class="search-panel">
                        <form id="search-form">
                            <div class="select-list">
                                <ul>
                                    <li>
                                        用户编号：<input type="text" name="userId" />
                                    </li>
                                    <li>
                                        用户姓名：<input type="text" name="termId" />
                                    </li>
                                    <li>
                                        用户状态：<select name="status" class="select2">
                                            <option value="">请选择状态</option>
                                            <option value="0">正常</option>
                                            <option value="1">停用</option>
                                        </select>
                                    </li>
                                    <li>
                                        <a class="btn btn-primary btn-round btn-sm btn-search-submit" onclick="$.table.search()"><i
                                                class="fa fa-search"></i>&nbsp;搜索</a>
                                        <a class="btn btn-warning btn-round btn-sm btn-search-reset" onclick="$.form.reset()"><i
                                                class="fa fa-refresh"></i>&nbsp;重置</a>
                                    </li>
                                </ul>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="btn-group-sm" id="toolbar" role="group">
                    <a class="btn btn-primary btn-list-top-add" onclick="$.operate.add()">
                        <i class="fa fa-plus"></i> 新增用户
                    </a>
                    <a class="btn btn-danger" onclick="$.modal.msg('您点击了删除用户按钮')">
                        <i class="fa fa-remove"></i> 删除用户
                    </a>
                    <a class="btn btn-success" onclick="$.modal.msg('您点击了数据导出按钮')">
                        <i class="fa fa-download"></i> 数据导出
                    </a>
                </div>
                <div class="col-md-12 select-table">
                    <div class="panel">
                        <div class="panel-body-sm">
                            <table id="bootstrap-table"></table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="./../../../static/js/include/_include-js.js"></script>

    <script type="text/javascript">

        function userEditor(){
            $.modal.open("修改用户信息","./../../../pages/examples/pages/user_edit.html");
        }

        $(function () {
            var options = {
                url: "./../../../static/data/user_list.json",
                method: 'get',
                modalName:'用户信息',
                createUrl:"./../../../pages/examples/pages/user_add.html",
                showSearch: true,
                showRefresh: true,
                showToggle: true,
                showColumns: true,
                clickToSelect: true,
                sidePagination: 'client',
                columns: [{
                    checkbox: true
                },
                {
                    title: '序号',
                    width: 5,
                    align: "center",
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field: 'loginname',
                    title: '用户账号'
                },
                {
                    field: 'name',
                    title: '用户姓名'
                },
                {
                    field: 'phone',
                    title: '用户手机'
                },
                {
                    field: 'mail',
                    title: '用户邮箱'
                },
                {
                    field: 'status',
                    title: '用户状态',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return '<label class="badge badge-primary">正常</label>';
                        } else {
                            return '<label class="badge badge-danger">停用</label>';
                        }
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-primary btn-xs" href="#" onclick="userEditor()"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>

</html>